import type { BaseEntity, ID, IDS, PageQuery, PageResult } from '#/api/common';

import { requestClient } from '#/api/request';

export interface SysMessage extends BaseEntity {
  msgId: ID;
  title: string;
  content: string;
  status: string;
}

const baseUrl = '/sys_biz/sys_message';

/** 查询系统公告列表 */
export function listMessage(params: PageQuery) {
  return requestClient.get<PageResult<SysMessage>>(`${baseUrl}/list`, {
    params,
  });
}

/** 系统公告详情 */
export function getMessage(id: ID) {
  return requestClient.get(`${baseUrl}/${id}`);
}

/** 新增系统公告 */
export function addMessage(data: any) {
  return requestClient.post(`${baseUrl}/add`, data);
}

/** 修改系统公告 */
export function editMessage(data: any) {
  return requestClient.post(`${baseUrl}/edit`, data);
}

/** 删除系统公告 */
export function delMessage(msgIds: IDS) {
  return requestClient.post(`${baseUrl}/remove`, msgIds);
}
